<template>
  <view class="orders-container">
    <!-- 顶部标题栏 -->
    <view class="page-header">
      <view class="header-title">我的工单</view>
      <view class="search-btn" @click="showSearchPopup">
        <text class="search-icon">🔍</text>
        <text>搜索</text>
      </view>
    </view>
    
    <!-- 标签栏（可横向滚动） -->
    <scroll-view 
      class="tabs-scroll" 
      scroll-x 
      show-scrollbar="false"
      :scroll-with-animation="true"
    >
      <view class="tabs">
        <view 
          class="tab-item" 
          :class="{ active: activeTab === 'pending' }"
          @click="switchTab('pending')"
        >
          待处理
          <view class="tab-badge" v-if="tabCounts.pending > 0">
            {{ tabCounts.pending }}
          </view>
        </view>
        <view 
          class="tab-item" 
          :class="{ active: activeTab === 'unpaid' }"
          @click="switchTab('unpaid')"
        >
          待支付
          <view class="tab-badge" v-if="tabCounts.unpaid > 0">
            {{ tabCounts.unpaid }}
          </view>
        </view>
        <view 
          class="tab-item" 
          :class="{ active: activeTab === 'completed' }"
          @click="switchTab('completed')"
        >
          已完成
          <view class="tab-badge" v-if="tabCounts.completed > 0">
            {{ tabCounts.completed }}
          </view>
        </view>
      </view>
    </scroll-view>
    
    <!-- 工单列表 -->
    <view class="order-list">
      <!-- 工单项 -->
      <view 
        class="order-item" 
        v-for="order in filteredOrders" 
        :key="order.id"
        @click="viewDetail(order.id)"
      >
        <!-- 工单头部 -->
        <view class="order-header">
          <view class="order-number">
            <text class="number-label">工单编号：</text>
            <text>{{ order.id }}</text>
          </view>
          <view 
            class="order-status" 
            :class="`status-${order.status}`"
          >
            {{ getStatusText(order.status) }}
          </view>
        </view>
        
        <!-- 工单标题 -->
        <view class="order-title">
          {{ order.title }}
        </view>
        
        <!-- 工单详情 -->
        <view class="order-details">
          <view class="detail-row">
            <text class="detail-icon">🔧</text>
            <text class="detail-label">类型</text>
            <text class="detail-value">{{ getOrderTypeText(order.type) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-icon">📍</text>
            <text class="detail-label">地址</text>
            <text class="detail-value">{{ order.address }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-icon">⏰</text>
            <text class="detail-label">时间</text>
            <text class="detail-value">{{ order.createTime }}</text>
          </view>
          <view class="detail-row price-row">
            <text class="detail-icon">💴</text>
            <text class="detail-label">报酬</text>
            <text class="detail-value">¥{{ order.servicePay }}</text>
          </view>
        </view>
        
        <!-- 操作按钮 -->
        <view class="order-actions">
          <button class="detail-btn" @click.stop="viewDetail(order.id)">
            查看详情
          </button>
          <button 
            class="review-btn" 
            @click.stop="viewReview(order.id)"
            v-if="order.status === 4"
          >
            查看评价
          </button>
          <button 
            class="return-btn" 
            @click.stop="returnToHall(order.id)"
            v-if="order.status === 1"
          >
            退回订单
          </button>
        </view>
      </view>
      
      <!-- 空状态 -->
      <view class="empty-state" v-if="filteredOrders.length === 0 && !loading">
        <image class="empty-img" src="/static/empty/empty-order.png" mode="widthFix"></image>
        <view class="empty-text">暂无相关工单</view>
        <view class="empty-subtext">
          {{ activeTab === 'pending' ? '您暂无待处理的工单' : 
             activeTab === 'unpaid' ? '您暂无待支付的工单' : 
             '您暂无已完成的工单' }}
        </view>
        <button 
          class="goto-hall" 
          @click="gotoHall"
          v-if="activeTab === 'pending'"
        >
          去抢单大厅
        </button>
      </view>
      
      <!-- 加载状态 -->
      <view class="loading-state" v-if="loading">
        <view class="loading-text">加载中...</view>
      </view>
    </view>
    
    <!-- 搜索弹窗 -->
    <view class="search-popup" v-if="showSearch" @click="hideSearchPopup">
      <view class="search-content" @click.stop>
        <view class="search-header">
          <text class="search-title">搜索工单</text>
          <text class="close-btn" @click="hideSearchPopup">×</text>
        </view>
        <view class="search-input-container">
          <input 
            class="search-input" 
            placeholder="请输入工单标题" 
            v-model="searchKeyword"
            @confirm="performSearch"
          />
          <text class="clear-icon" @click="clearSearch" v-if="searchKeyword">×</text>
        </view>
        <view class="search-actions">
          <button class="cancel-btn" @click="hideSearchPopup">取消</button>
          <button class="search-confirm-btn" @click="performSearch">搜索</button>
        </view>
      </view>
    </view>
    
    <!-- 评价详情弹窗 -->
    <view class="review-popup" v-if="showReviewPopup" @click="hideReviewPopup">
      <view class="review-content" @click.stop>
        <view class="review-header">
          <text class="review-title">订单评价</text>
          <text class="close-btn" @click="hideReviewPopup">×</text>
        </view>
        <view class="review-body">
          <view class="star-rating">
            <text class="label">评分：</text>
            <view class="stars">
              <text 
                v-for="i in 5" 
                :key="i" 
                class="star"
                :class="{ 'star-filled': i <= reviewData.starRating }"
              >★</text>
            </view>
            <text class="rating-text">{{ reviewData.starRating }}分</text>
          </view>
          <view class="review-content-item">
            <text class="label">评价内容：</text>
            <textarea 
              class="content-text" 
              :value="reviewData.content" 
              disabled
            ></textarea>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref, computed, onMounted, onActivated } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { useRouter } from 'vue-router'
import { getOrderList, searchOrdersByTitle, cancelOrder, getOrderReview } from '../../api/order.js'

// 核心修复1：安全获取路由实例，添加兜底逻辑
const router = useRouter?.() || {
  push: (options) => {
    // 路由实例不存在时，使用uni.navigateTo兜底
    const url = typeof options === 'string' 
      ? options 
      : `${options.path}?${new URLSearchParams(options.query).toString()}`
    uni.navigateTo({ url })
  }
}

// 工单数据
const orders = ref([])

// 加载状态
const loading = ref(false)

// 搜索相关数据
const showSearch = ref(false)
const searchKeyword = ref('')
const searchResults = ref([])

// 评价弹窗相关数据
const showReviewPopup = ref(false)
const reviewData = ref({
  starRating: 0,
  content: ''
})

// 页面加载时执行
onMounted(() => {
  // 验证路由实例是否有效
  if (!router) {
    console.warn('路由实例未初始化，已启用兼容模式')
  }
  // 获取工单列表
  fetchOrderList()
})

// 页面显示时检查登录状态
onShow(() => {
  const userInfo = uni.getStorageSync('userInfo');
  if (!userInfo || !userInfo.userId) {
    // 用户未登录，跳转到登录页面
    uni.redirectTo({
      url: '/pages/login/login'
    });
  }
})

// 页面激活时也刷新数据（从其他页面返回时）
onActivated(() => {
  fetchOrderList()
})

// 获取工单列表
const fetchOrderList = async () => {
  loading.value = true
  try {
    const res = await getOrderList()
    console.log('获取工单列表:', res)
    
    if (res && res.code === 0) {
      // 获取当前登录员工ID
      const userInfo = uni.getStorageSync('userInfo')
      const employeeId = userInfo?.userId
      
      // 按创建时间降序排序
      let sortedOrders = (res.data || []).sort((a, b) => {
        // 如果有createTime字段，按createTime排序
        if (a.createTime && b.createTime) {
          return new Date(b.createTime) - new Date(a.createTime);
        }
        // 如果没有createTime字段，按id降序排序
        return b.id - a.id;
      });
      
      // 如果有员工ID，则只显示分配给该员工的订单
      if (employeeId) {
        // 修复：使用更宽松的匹配条件，支持多种字段名
        sortedOrders = sortedOrders.filter(order => {
          // 检查订单是否分配给当前员工（支持多种字段名）
          return (order.employeeId != null && order.employeeId == employeeId) || 
                 (order.empId != null && order.empId == employeeId)
        })
        console.log(`过滤后订单数量: ${sortedOrders.length}, 员工ID: ${employeeId}`)
      } else {
        console.log('未找到员工ID，显示所有订单')
      }
      
      orders.value = sortedOrders;
    } else {
      uni.showToast({ title: res?.msg || '获取工单列表失败', icon: 'none' })
    }
  } catch (error) {
    console.error('获取工单列表失败:', error)
    uni.showToast({ title: '获取工单列表失败', icon: 'none' })
  } finally {
    loading.value = false
  }
}

// 当前激活的标签
const activeTab = ref('pending')

// 计算每个标签的工单数量
const tabCounts = computed(() => {
  return {
    pending: orders.value.filter(order => order.status === 1 || order.status === 0).length,
    // 待支付订单：未支付且状态为2(已完成)或4(已评论)的订单
    unpaid: orders.value.filter(order => (order.payStatus === 0 || order.payStatus == null) && (order.status === 2 || order.status === 4)).length,
    // 已完成标签页：已支付且状态为2(已完成)或4(已评论)的订单
    completed: orders.value.filter(order => order.payStatus === 1 && (order.status === 2 || order.status === 4)).length
  }
})

// 根据当前标签和搜索关键词筛选工单
const filteredOrders = computed(() => {
  // 如果有搜索结果，优先显示搜索结果
  if (searchResults.value.length > 0) {
    return searchResults.value
  }
  
  // 先根据标签筛选
  let result = []
  if (activeTab.value === 'pending') {
    // 待处理订单：状态为0(待分配)或1(待处理)
    result = orders.value.filter(order => order.status === 0 || order.status === 1)
  } else if (activeTab.value === 'unpaid') {
    // 待支付订单：未支付且状态为2(已完成)或4(已评论)
    result = orders.value.filter(order => (order.payStatus === 0 || order.payStatus == null) && (order.status === 2 || order.status === 4))
  } else if (activeTab.value === 'completed') {
    // 已完成标签页：已支付且状态为2(已完成)或4(已评论)的订单
    result = orders.value.filter(order => order.payStatus === 1 && (order.status === 2 || order.status === 4))
  }
  
  // 如果有搜索关键词，则进一步筛选
  if (searchKeyword.value) {
    result = result.filter(order => 
      (order.title && order.title.includes(searchKeyword.value)) ||
      (order.des && order.des.includes(searchKeyword.value))
    )
  }
  
  return result
})

// 切换标签
const switchTab = (tabName) => {
  activeTab.value = tabName
  // 清空搜索关键词和结果
  searchKeyword.value = ''
  searchResults.value = []
  // 滚动到顶部
  uni.pageScrollTo({
    scrollTop: 0,
    duration: 300
  })
}

// 获取工单类型文本
const getOrderTypeText = (type) => {
  const map = {
    0: '普通',
    1: '紧急'
  }
  return map[type] || '未知类型'
}

// 获取状态文本
const getStatusText = (status) => {
  const map = {
    0: '待分配',
    1: '待处理',
    2: '已完成',
    3: '已取消',
    4: '已评论'
  }
  return map[status] || '未知状态'
}

// 核心修复2：查看详情 - 添加错误捕获和参数校验
const viewDetail = (orderId) => {
  if (!orderId) {
    uni.showToast({ title: '工单ID无效', icon: 'none' })
    return
  }
  
  try {
    router.push({
      path: '/pages/order-detail/detail',
      query: { id: orderId }
    })
  } catch (e) {
    console.error('路由跳转失败:', e)
    // 降级方案：直接使用uni.navigateTo
    uni.navigateTo({
      url: `/pages/order-detail/detail?id=${orderId}`,
      fail: () => {
        uni.showToast({ title: '无法打开详情页', icon: 'none' })
      }
    })
  }
}

// 查看评价
const viewReview = async (workOrderId) => {
  console.log('点击查看评价按钮，工单ID:', workOrderId);
  if (!workOrderId) {
    uni.showToast({ title: '工单ID无效', icon: 'none' })
    return
  }
  
  try {
    uni.showLoading({ title: '加载中...' })
    const res = await getOrderReview(workOrderId)
    console.log('获取评价信息响应:', res)
    
    if (res && res.code === 0 && res.data) {
      console.log('评价数据:', res.data)
      // 确保正确设置reviewData的值
      reviewData.value = {
        starRating: res.data.starRating || res.data.rating || res.data.stars || 0,
        content: res.data.content || res.data.comment || res.data.reviewContent || ''
      }
      console.log('设置后的reviewData:', reviewData.value)
    } else {
      // 即使没有评价信息，也设置默认值
      reviewData.value = {
        starRating: 0,
        content: '暂无评价内容'
      }
      console.log('无评价数据，设置默认值:', reviewData.value);
    }
    // 无论如何都显示弹窗
    console.log('显示评价弹窗');
    showReviewPopup.value = true
  } catch (error) {
    console.error('获取评价信息失败:', error)
    // 出错时也显示弹窗，但显示错误信息
    reviewData.value = {
      starRating: 0,
      content: '获取评价信息失败: ' + (error.message || '')
    }
    console.log('出错，但仍显示弹窗:', reviewData.value);
    showReviewPopup.value = true
  } finally {
    uni.hideLoading()
  }
}

// 隐藏评价弹窗
const hideReviewPopup = () => {
  console.log('隐藏评价弹窗');
  showReviewPopup.value = false
}

// 退回大厅
const returnToHall = (orderId) => {
  uni.showModal({
    title: '确认取消订单',
    content: '确定要取消此订单吗？取消后将不能恢复',
    confirmText: '确认取消',
    cancelText: '取消',
    confirmColor: '#FF4D4F',
    success: async (res) => {
      if (res.confirm) {
        // 调用后端取消订单接口
        uni.showLoading({ title: '处理中...' })
        try {
          const response = await cancelOrder(orderId)
          if (response && response.code === 0) {
            // 更新订单状态为已取消 (状态码3)
            const index = orders.value.findIndex(item => item.id === orderId)
            if (index > -1) {
              // 更新订单状态
              orders.value[index].status = 3
              
              // 如果当前在待处理标签页，则移除该订单
              if (activeTab.value === 'pending') {
                orders.value.splice(index, 1)
              }
              
              // 更新搜索结果（如果有）
              const searchIndex = searchResults.value.findIndex(item => item.id === orderId)
              if (searchIndex > -1) {
                searchResults.value.splice(searchIndex, 1)
              }
            }
            
            uni.showToast({ 
              title: '订单已取消', 
              icon: 'success',
              duration: 1500,
              success: () => {
                // 1.5秒后刷新数据
                fetchOrderList()
              }
            })
          } else {
            uni.showToast({ 
              title: response?.msg || '取消订单失败', 
              icon: 'none',
              duration: 2000
            })
          }
        } catch (error) {
          console.error('取消订单失败:', error)
          uni.showToast({ 
            title: '网络异常，请重试', 
            icon: 'none',
            duration: 2000
          })
        } finally {
          uni.hideLoading()
        }
      }
    }
  })
}

// 核心修复3：前往抢单大厅 - 安全跳转
const gotoHall = () => {
  try {
    router.push('/pages/hall/hall')
  } catch (e) {
    console.error('跳转大厅失败:', e)
    uni.switchTab({ url: '/pages/hall/hall' }) // Tab页用switchTab更合适
  }
}

// 显示搜索弹窗
const showSearchPopup = () => {
  showSearch.value = true
}

// 隐藏搜索弹窗
const hideSearchPopup = () => {
  showSearch.value = false
}

// 清空搜索关键词
const clearSearch = () => {
  searchKeyword.value = ''
  // 如果有搜索结果，恢复显示全部工单
  if (searchResults.value.length > 0) {
    searchResults.value = []
  }
}

// 执行搜索
const performSearch = async () => {
  if (!searchKeyword.value.trim()) {
    uni.showToast({
      title: '请输入搜索关键词',
      icon: 'none'
    })
    return
  }
  
  // 关闭弹窗
  hideSearchPopup()
  
  // 显示加载提示
  uni.showLoading({
    title: '搜索中...'
  })
  
  try {
    // 调用后端搜索接口，但只搜索当前标签页的工单
    const res = await searchOrdersByTitle(searchKeyword.value)
    
    if (res && res.code === 0) {
      // 搜索成功，但只保留当前标签页的工单
      let results = res.data || []
      if (activeTab.value === 'pending') {
        results = results.filter(order => order.status === 1)
      } else if (activeTab.value === 'unpaid') {
        results = results.filter(order => order.payStatus === 0 && (order.status === 2 || order.status === 4))
      } else if (activeTab.value === 'completed') {
        results = results.filter(order => order.payStatus === 1 && (order.status === 2 || order.status === 4))
      }
      searchResults.value = results
    } else {
      // 使用前端过滤作为备选方案，但只在当前标签页的工单中搜索
      let currentTabOrders = []
      if (activeTab.value === 'pending') {
        currentTabOrders = orders.value.filter(order => order.status === 1)
      } else if (activeTab.value === 'unpaid') {
        currentTabOrders = orders.value.filter(order => order.payStatus === 0 && (order.status === 2 || order.status === 4))
      } else if (activeTab.value === 'completed') {
        currentTabOrders = orders.value.filter(order => order.payStatus === 1 && (order.status === 2 || order.status === 4))
      }
        
      searchResults.value = currentTabOrders.filter(order => 
        order.title && order.title.includes(searchKeyword.value)
      )
    }
    
    uni.showToast({
      title: `找到${searchResults.value.length}条记录`,
      icon: 'none'
    })
  } catch (error) {
    console.error('搜索失败:', error)
    // 出错时使用前端过滤作为备选方案，但只在当前标签页的工单中搜索
    let currentTabOrders = []
    if (activeTab.value === 'pending') {
      currentTabOrders = orders.value.filter(order => order.status === 1)
    } else if (activeTab.value === 'unpaid') {
      currentTabOrders = orders.value.filter(order => order.payStatus === 0 && (order.status === 2 || order.status === 4))
    } else if (activeTab.value === 'completed') {
      currentTabOrders = orders.value.filter(order => order.payStatus === 1 && (order.status === 2 || order.status === 4))
    }
      
    searchResults.value = currentTabOrders.filter(order => 
      order.title && order.title.includes(searchKeyword.value)
    )
    uni.showToast({
      title: `前端过滤找到${searchResults.value.length}条记录`,
      icon: 'none'
    })
  } finally {
    uni.hideLoading()
  }
}

</script>

<style scoped>
.orders-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 28rpx;
}

/* 顶部标题栏 */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20rpx 30rpx;
  background-color: rgba(255, 255, 255, 0.9);
  border-bottom: 1rpx solid #f0f0f0;
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10rpx);
}

/* 搜索输入框容器 */
.search-input-container {
  position: relative;
  width: 100%;
}

/* 清空按钮样式 */
.clear-icon {
  position: absolute;
  right: 20rpx;
  top: 50%;
  transform: translateY(-50%);
  font-size: 32rpx;
  color: #999;
  z-index: 10;
}

.header-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
}

/* 搜索按钮 */
.search-btn {
  display: flex;
  align-items: center;
  padding: 10rpx 20rpx;
  background-color: #f5f5f5;
  border-radius: 30rpx;
  font-size: 24rpx;
  color: #666;
}

.search-icon {
  margin-right: 10rpx;
  font-size: 28rpx;
}

/* 搜索弹窗 */
.search-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.search-content {
  width: 80%;
  background-color: #fff;
  border-radius: 20rpx;
  padding: 30rpx;
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30rpx;
}

.search-title {
  font-size: 32rpx;
  font-weight: bold;
  color: #333;
}

.close-btn {
  font-size: 40rpx;
  color: #999;
}

.search-input {
  width: 100%;
  height: 80rpx;
  padding: 0 20rpx;
  border: 1rpx solid #e0e0e0;
  border-radius: 10rpx;
  font-size: 28rpx;
  box-sizing: border-box;
}

.search-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 30rpx;
}

.cancel-btn, .search-confirm-btn {
  flex: 1;
  height: 70rpx;
  line-height: 70rpx;
  border-radius: 10rpx;
  font-size: 28rpx;
}

.cancel-btn {
  background-color: #f5f5f5;
  color: #666;
  margin-right: 20rpx;
}

.search-confirm-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  margin-left: 20rpx;
}

.tabs-scroll {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15rpx 0;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10rpx);
}

.tabs {
  display: flex;
  white-space: nowrap;
  padding: 0 30rpx;
}

.tab-item {
  display: inline-block;
  padding: 20rpx 30rpx;
  font-size: 28rpx;
  color: #666;
  position: relative;
}

.tab-item.active {
  color: #007AFF;
  font-weight: bold;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4rpx;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tab-badge {
  position: absolute;
  top: 10rpx;
  right: 10rpx;
  background-color: #ff4d4f;
  color: white;
  border-radius: 50%;
  width: 32rpx;
  height: 32rpx;
  font-size: 20rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-list {
  padding: 20rpx;
}

.order-item {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 16rpx;
  padding: 25rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10rpx);
}

.order-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20rpx;
  padding-bottom: 15rpx;
  border-bottom: 1rpx dashed #eee;
}

.order-number {
  color: #333;
}

.number-label {
  color: #999;
  margin-right: 5rpx;
}

.order-status {
  padding: 5rpx 15rpx;
  border-radius: 40rpx;
  font-size: 24rpx;
  font-weight: 500;
}

.status-0 {
  background-color: #e6f7ff;
  color: #1890ff;
}

.status-pending {
  background-color: #fff7e6;
  color: #ff9a2e;
}

.status-completed {
  background-color: #e6ffed;
  color: #00b42a;
}

.status-3 {
  background-color: #f0f0f0;
  color: #999;
}

/* 工单标题 */
.order-title {
  font-size: 28rpx;
  font-weight: 600;
  color: #333;
  margin: 10rpx 0 20rpx;
  padding: 0 25rpx;
  line-height: 1.4;
}

.order-details {
  margin-bottom: 20rpx;
}

.detail-row {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;
  line-height: 1.5;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-icon {
  margin-right: 15rpx;
  font-size: 28rpx;
  width: 30rpx;
  text-align: center;
}

.detail-label {
  color: #999;
  margin-right: 10rpx;
  width: 80rpx;
}

.detail-value {
  flex: 1;
  color: #666;
  word-break: break-all;
}

.price-row .detail-value {
  color: #ff4d4f;
  font-weight: 500;
}

.order-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15rpx;
  margin-top: 20rpx;
}

.detail-btn {
  padding: 0 25rpx;
  height: 60rpx;
  line-height: 60rpx;
  background-color: #f5f7fa;
  color: #666;
  border-radius: 30rpx;
  font-size: 24rpx;
}

.review-btn {
  padding: 0 25rpx;
  height: 60rpx;
  line-height: 60rpx;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 30rpx;
  font-size: 24rpx;
}

.return-btn {
  padding: 0 25rpx;
  height: 60rpx;
  line-height: 60rpx;
  background-color: #fff2f0;
  color: #ff4d4f;
  border-radius: 30rpx;
  font-size: 24rpx;
}

.empty-state {
  padding: 100rpx 20rpx;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 16rpx;
  box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10rpx);
}

.empty-img {
  width: 200rpx;
  height: 200rpx;
  margin-bottom: 30rpx;
  opacity: 0.6;
}

.empty-text {
  font-size: 30rpx;
  color: #666;
  margin-bottom: 15rpx;
}

.empty-subtext {
  font-size: 24rpx;
  color: #999;
  margin-bottom: 40rpx;
}

.goto-hall {
  padding: 0 40rpx;
  height: 70rpx;
  line-height: 70rpx;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 35rpx;
  font-size: 26rpx;
}

/* 评价弹窗样式 */
.review-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.review-content {
  width: 80%;
  background-color: #fff;
  border-radius: 20rpx;
  padding: 30rpx;
  max-height: 80%;
  overflow-y: auto;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30rpx;
  padding-bottom: 20rpx;
  border-bottom: 1rpx solid #eee;
}

.review-title {
  font-size: 32rpx;
  font-weight: bold;
  color: #333;
}

.close-btn {
  font-size: 40rpx;
  color: #999;
}

.review-body {
  display: flex;
  flex-direction: column;
  gap: 20rpx;
}

.star-rating {
  display: flex;
  align-items: center;
  gap: 10rpx;
}

.label {
  font-size: 28rpx;
  color: #333;
  min-width: fit-content;
}

.stars {
  display: flex;
  gap: 5rpx;
}

.star {
  font-size: 36rpx;
  color: #ccc;
}

.star-filled {
  color: #ffcc00;
}

.rating-text {
  font-size: 28rpx;
  color: #666;
  margin-left: 10rpx;
}

.review-content-item {
  display: flex;
  flex-direction: column;
  gap: 10rpx;
}

.content-text {
  width: 100%;
  min-height: 150rpx;
  padding: 15rpx;
  border: 1rpx solid #eee;
  border-radius: 10rpx;
  font-size: 26rpx;
  color: #333;
  background-color: #f9f9f9;
  box-sizing: border-box;
}
</style>